package pytest

import javax.validation.constraints.{Size, Min}
import scaladuct.lists.scala.{ListForProperty, ListsManager}
import scaladuct.{Property, Starter}
import scaladuct.hint.Help
import scaladuct.lists.ListsSource
import java.util.{ArrayList, Date}
import chloroform.NiceEnum1

/**
 * <p>
 * Created by IntelliJ IDEA.
 * User: zslajchrt
 * Date: Jan 16, 2011
 * Time: 7:01:42 PM
 */

class SampleStarterB extends Starter[String] with ListsSource {

  def newInstance(): String = phaseOne(1, "xyz", true, NiceEnum1.NiceValue1, new Date(), new ArrayList[Any]())

  @Help("phaseOne")
  def phaseOne(@Min(100) @Help a: Int,
               @Size(min = 3, max = 10) b: String,
               c: Boolean,
               d: NiceEnum1,
               e: Date,
               f: java.util.List[Any]
               ): String = {
    ""
  }

  def destroy(instance: String) = null

  def listsForPhase(phase: String) = phase match  {
    case "phaseOne" => {
      Some(new ListsManager {
        def scalaListForProperty(property: Property[AnyRef]) = property.name match {
          case "parameter1" => {
            Some(new ListForProperty(property, List("Value1", "Value2", "Value3"), true, true))
          }
          case _ => None
        }
      })
    }
    case _ => None
  }
}